package com.biz.hunter.webchat.controller;

import com.biz.hunter.dao.CompanyDAO;
import com.biz.hunter.dao.JobTitleDAO;
import com.biz.hunter.dao.MemberDAO;
import com.biz.hunter.db.entity.MemberPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("register")
public class RegistController {

    @Autowired
    MemberDAO memberDAO;

    @Autowired
    CompanyDAO companyDAO;

    @Autowired
    JobTitleDAO roleDAO;


    @RequestMapping(value={"/getFee"})
    @ResponseBody
    public Map<String,Object> enlist(HttpServletRequest request, String phone){
        HashMap<String, Object> map = new HashMap<String, Object>();
        HttpSession session = request.getSession();
        String openid = (String) session.getAttribute("OpenId");
        if (openid == null) {
            openid = "0";
        }
        System.out.println(openid);
        MemberPO memberPO = memberDAO.getByPhone(phone,openid);
        String total = "988";
        if (memberPO!=null) {
            if ("黑卡会员(1年)".equals(memberPO.getOrdername())) {
                total="588";
            } else if ("高级会员(半年)".equals(memberPO.getOrdername())) {
                total="688";
            }
        }
        System.out.println("TotalPay:"+total);
        map.put("code",200);
        map.put("total",total);
        return map;
    }

}
